Exception Handling for Error Reporting in Parsing Expression Grammars
نویسندگان
چکیده
Parsing Expression Grammars (PEGs) are a new formalism to describe a top-down parser of a language. However, error handling techniques that are often applied to top-down parsers are not directly applicable to PEGs. This problem is usually solved in PEGs using a heuristic that helps to simulate the error reporting technique from topdown parsers, but the error messages are generic. We propose the introduction of labeled failures to PEGs for error reporting, as labels help to produce more meaningful error messages. The labeled failures approach is close to that of generating and handling exceptions often used in programming languages, being useful to annotate and label grammar pieces that should not fail. Moreover, our approach is an extension to the PEGs formalism that is expressive enough to implement some previous work on parser combinators. Finally, labeled failures are also useful to compose grammars preserving the error messages of each separate grammar.
منابع مشابه
Error Reporting in Parsing Expression Grammars
Parsing Expression Grammars (PEGs) describe top-down parsers. Unfortunately, the errorreporting techniques used in conventional top-down parsers do not directly apply to parsers based on Parsing Expression Grammars (PEGs), so they have to be somehow simulated. While the PEG formalism has no account of semantic actions, actual PEG implementations add them, and we show how to simulate an error-re...
متن کاملDeterministic, Error-Correcting Combinator Parsers
We show how error-correcting, deterministic, combinator parsers can be constructed for grammars which have the LL(1) property. The normal disadvantages of conventional combinator parsers, such as their lack of speed and their poor error reporting, are remedied. Parsers constructed with these combinators are implicitly specialised for the grammar they describe. Because of this property the combi...
متن کاملEfficient and Comfortable Error Recovery in Recursive Descent Parsers
This paper describes the interesting features of the recursive descent parser generator Ell from the user’s point of view. Some of the interesting implementation aspects are discussed. The generated parsers are extremely fast and run at speed of 55,000 tokens per second or 900,000 lines per minute on a MC 68020 processor. The outstanding features of Ell are the L-attribution mechanism, its abil...
متن کاملAn extension of recursive descent parsing for Boolean grammars
The well-known recursive descent parsing method for context-free grammars is extended for their generalization, Boolean grammars, which include explicit set-theoretic operations in the formalism of rules. Conjunction is implemented by scanning a part of the input multiple times, while the mechanism of exception handling is used to implement negation. A subclass of LL(k) Boolean grammars, for wh...
متن کاملAutomatic Parsing of Sports Videos with Grammars
Motivated by the analogies between languages and sports videos, we introduce a novel approach for video parsing with grammars. It utilizes compiler techniques for integrating both semantic annotation and syntactic analysis to generate a semantic index of events and a table of content for a given sports video. The video sequence is first segmented and annotated by event detection with domain kno...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2013